import axios from "axios";
import {ElMessage} from "element-plus";

const request = axios.create({
    baseURL: 'host:port',
    timeout: 30000
})

request.interceptors.request.use(config => {

    return config;
}, error => {
    return Promise.reject(error);
})

request.interceptors.response.use(response => {
    if (response.data.status === false){
        ElMessage.error(response.data.message);
    }
    return response.data
}, error => {
    return Promise.reject(error);
})

export default request
